package com.weiqiao.api.repository;


import com.weiqiao.base.dao.IBaseMongoDao;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * 收支明细持久层 接口 继承IBaseMongoDao
 *
 * @author user
 */
public interface IAccountDetailApiRepository extends IBaseMongoDao {

    /**
     * 新增收支明细
     *
     * @param company_id
     * @param json
     * @return
     */

    boolean addAccountDetail(int company_id, String json);

    /**
     * 排序查询功能优化 排序 并制定输出条数
     */
    List<String> getAccountDetailByFilterSortLimit(int company_id, Bson filter, Bson filterSort, int skip, int limit);

    boolean updateDetail(Document doc, Bson filter, int company_id);

    String findOneAccountDetail(int company_id, Bson filter);

    /**
     * 根据条件查询所有流水
     *
     * @param company_id
     * @param filter
     * @return
     */
    List<String> findAccountDetailsByFilter(int company_id, Bson filter, Bson sort);

    int countNum(int company_id, Bson delete_flag);

    /**
     * 分页获取内容
     * @param companyId
     * @param filter
     * @param pageable
     * @return
     */
    List<String> findPage(int companyId, Bson filter, Pageable pageable);

    /**
     * 根据条件查询集合
     * @param companyId
     * @param filter
     * @return
     */
    List<String> getListByFilter(int companyId, Bson filter);
}
